<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <link rel="stylesheet" href="http://cdn.staticfile.org/cesium/1.69.0/Widgets/widgets.css">
    <link rel="stylesheet" href="../css//index.css">
</head>

<body>
    <div class="fun-menu">
        <button onclick="switchBasemap('arcgis')">arcgis-电子地图</button>
        <button onclick="switchBasemap('arcgis4490')">arcgis4490</button>
        <button onclick="switchBasemap('tdt_image')">天地图-影像</button>
        <button onclick="switchBasemap('tdt_image_mark')">天地图-影像+注记</button>
        <button onclick="switchBasemap('tdt_digital')">天地图-电子地图</button>
        <button onclick="switchBasemap('amap_image')">高德-影像</button>
        <button onclick="switchBasemap('amap_digital_mark')">高德-影像+注记</button>
        <button onclick="switchBasemap('amap_digital')">高德-电子</button>
        <button onclick="switchBasemap('tencent_digital')">腾讯-电子</button>
        <button onclick="switchBasemap('tencent_image')">腾讯-影像</button>
        <button onclick="switchBasemap('tencent_mark')">腾讯-注记</button>
        <button onclick="switchBasemap('tencent_image_mark')">腾讯-影像-注记</button>
        <button onclick="switchBasemap('google_image')">谷歌-影像</button>
        <button onclick="switchBasemap('baidu_digital')">百度-电子</button>
        <button onclick="switchBasemap('baidu_image')">百度-影像</button>
        <button onclick="switchBasemap('baidu_mark')">百度-注记</button>
        <button onclick="switchBasemap('SingleTileImageryLayer')">单张图片底图</button>
        <button onclick="switchBasemap('WebMapServiceImageryLayer')">wms</button>
    </div>
    <div id=cesiumContainer></div>

    <script src="http://cdn.staticfile.org/cesium/1.69.0/Cesium.js"></script>
    <script src="../libs/cpc/index.js"></script>
    <script>
        const map = new cpc.Map({
            container: "cesiumContainer",
            baseMaps: [
                "http://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer",
            ]
        });

        function switchBasemap(type) {
            let basemap;
            switch (type) {
                case "arcgis":
                    basemaps = [
                        {
                            type: "ArcGisImageryLayer",
                            url: "http://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer",
                        },
                    ];
                    break;
                case "arcgis4490":
                    console.log("需要指定修改过源码的版本支持https://blog.csdn.net/yanasdf789/article/details/109103514");
                    basemaps = [
                        {
                            type: "ArcGisImageryLayer",
                            url: "http://120.40.102.239:9651/arcgis/rest/services/Vector_CGCS2000/MapServer",//需要指定版本支持https://blog.csdn.net/yanasdf789/article/details/109103514
                        },
                    ];
                    break;
                case "tdt_image":
                    basemaps = [
                        {
                            type: "TDTImageryLayer",
                            mold: "image",
                            tk: "7b435c61bff7f77eb49206e10d6397bd",
                        },
                    ];
                    break;
                case "tdt_image_mark":
                    basemaps = [
                        {
                            type: "TDTImageryLayer",
                            mold: "image",
                            tk: "7b435c61bff7f77eb49206e10d6397bd",
                        },
                        {
                            type: "TDTImageryLayer",
                            mold: "mark",
                            tk: "7b435c61bff7f77eb49206e10d6397bd",
                        },
                    ];
                    break;
                case "tdt_digital":
                    basemaps = [
                        {
                            type: "TDTImageryLayer",
                            tk: "7b435c61bff7f77eb49206e10d6397bd",
                        },
                    ];
                    break;
                case "amap_image":
                    basemaps = [{ type: "AMapImageryLayer", mold: "image" }];
                    break;
                case "amap_digital_mark":
                    basemaps = [
                        { type: "AMapImageryLayer", mold: "image", },
                        { type: "AMapImageryLayer", mold: "mark", }
                    ];
                    break;
                case "amap_digital":
                    basemaps = [
                        {
                            type: "AMapImageryLayer",
                            mold: "digital",
                        },
                    ];
                    break;
                case "tencent_digital":
                    basemaps = [
                        {
                            type: "TencentImageryLayer",
                            mold: "digital"
                        },
                    ];
                    break;
                case "tencent_image":
                    basemaps = [
                        {
                            type: "TencentImageryLayer",
                            mold: "image"
                        },
                    ];
                    break;
                case "tencent_mark":
                    basemaps = [
                        {
                            type: "TencentImageryLayer",
                            mold: "mark"
                        },
                    ];
                    break;
                case "tencent_image_mark":
                    basemaps = [
                        {
                            type: "TencentImageryLayer",
                            mold: "image"
                        },
                        {
                            type: "TencentImageryLayer",
                            mold: "mark"
                        }
                    ];
                    break;
                case "google_image":
                    basemaps = [
                        {
                            type: "GoogleImageryLayer",
                        },
                    ];
                    break;
                case "baidu_image":
                    basemaps = [
                        {
                            type: "BDImageryLayer",
                            mold: "image"
                        }
                    ];
                    break;
                case "baidu_digital":
                    basemaps = [
                        {
                            type: "BDImageryLayer",
                            mold: "digital"
                        }
                    ];
                    break;
                case "baidu_mark":
                    basemaps = [
                        {
                            type: "BDImageryLayer",
                            mold: "mark"
                        }
                    ];
                    break;
                case "SingleTileImageryLayer":
                    basemaps = [
                        {
                            type: "SingleTileImageryLayer",
                            url: "../images/maps/world.jpg"
                        }
                    ];
                    break;
                case "WebMapServiceImageryLayer":
                    basemaps = [
                        {
                            type: "WebMapServiceImageryLayer",
                            url: 'http://basemap.nationalmap.gov/arcgis/rest/services/USGSShadedReliefOnly/MapServer/WMTS',
                            layer: 'USGSShadedReliefOnly',
                            style: 'default',
                            format: 'image/jpeg',
                            tileMatrixSetID: 'default028mm',
                            // tileMatrixLabels : ['default028mm:0', 'default028mm:1', 'default028mm:2' ...],
                            maximumLevel: 19,
                        },
                        // {
                        //     type: "WebMapServiceImageryLayer",
                        //     url:"http://120.40.102.239:9651/arcgis/rest/services/Image_CGCS2000_2012/MapServer/WMTS/tile/1.0.0/Image_CGCS2000_2012/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}",
                        //     layer : 'Image_CGCS2000_2012',
                        //     // TileMatrix:[0,1,2,3,4,5,6,7,8,9,10,11],
                        //     maximumLevel: 11,
                        //     style : 'default',
                        //     tileMatrixSetID : 'TileMatrix using 0.28mm',
                        // },
                    ];
                    break;
            }
            map.baseMap.switchBasemaps(basemaps);
        }

    </script>
</body>

</html>